// ml:run = $bin < input
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>

int k, sum;
std::string s;

int main()
{
    std::ios::sync_with_stdio(false);
    std::cin >> k >> s;
    for (auto ch : s)
        sum += ch - '0';
    if (sum >= k) {
        std::cout << "0\n";
        return 0;
    }

    std::sort(s.begin(), s.end());
    int len = s.size();
    int ans = 0;
    for (int i = 0; i < len; i++) {
        int now = s[i] - '0';
        sum += 9 - now;
        ans++;
        if (sum >= k) {
            std::cout << ans << "\n";
            return 0;
        }
    }
}

